package com.mall.shopping.converter;

import com.mall.commons.doc.ItemDoc;
import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dto.ProductDetailDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * 类<code>Doc</code>用于：TODO
 *
 * @author Acher
 * @version 1.0
 * @date 2021-10-31
 */
@Mapper(componentModel = "spring")
public interface ProductDetailConverter {

    @Mappings({
            @Mapping(source = "id",target = "productId"),
            @Mapping(source = "price",target = "salePrice"),
            @Mapping(source = "title",target = "productName"),
            @Mapping(source = "sellPoint",target = "subTitle"),
            @Mapping(source = "imageBig",target = "productImageBig"),
            @Mapping(source = "image",target = "productImageSmall")
    })
    ProductDetailDto itemDo2ProductDetailDto(Item item);

    @Mappings({
            @Mapping(source = "id",target = "productId"),
            @Mapping(source = "price",target = "salePrice"),
            @Mapping(source = "title",target = "productName"),
            @Mapping(source = "sellPoint",target = "subTitle"),
            @Mapping(source = "image",target = "productImageBig"),
            @Mapping(source = "image",target = "productImageSmall")
    })
    ProductDetailDto itemDoc2ProductDetailDto(ItemDoc itemDoc);
}
